import { defineStore } from "pinia";

export default defineStore("useAttentionStore", {
  state() {
    return {
      questions: [],
      currentQuestionIndex: 0
    };
  },
  actions: {
    setAttentionQuestions(questions) {
      this.questions = questions;
    },
    setAttentionQuestionAnswer(questionIndex, answerIndex) {
      this.questions[questionIndex].answer = answerIndex
    },
    setAttentionCurrentQuestion(questionIndex) {
      this.currentQuestionIndex = questionIndex
    }
  },
  persist: {
    enabled: true,
    strategies: [
      {
        storage: sessionStorage,
      },
    ],
  },
});
